﻿<phone:PhoneApplicationPage
    x:Class="wp8nop.Carrello"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    SupportedOrientations="Portrait" Orientation="Portrait"
    mc:Ignorable="d"
    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
    shell:SystemTray.IsVisible="True"
    toolkit:TiltEffect.IsTiltEnabled="True"
    DataContext="{Binding Carrello, Source={StaticResource Locator}}" Background="White">
    <phone:PhoneApplicationPage.Resources>
        <DataTemplate x:Key="VetrinaDataTemplate">
            <Grid Width="450"  Margin="8">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="190"/>
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>
                <Image Height="190" Width="190" Source="{Binding Model.imgs.thumb}"/>
                <Grid Grid.Column="1" Margin="5,0,0,0" >
                    <Grid.RowDefinitions>
                        <RowDefinition Height="56"/>
                        <RowDefinition Height="57*"/>
                        <RowDefinition Height="38*"/>
                        <RowDefinition Height="39*"/>
                    </Grid.RowDefinitions>
                    <TextBlock TextWrapping="Wrap" FontWeight="Bold" Text="{Binding Model.name}" FontSize="20" Foreground="Black"/>
                    <TextBlock Grid.Row="1" TextWrapping="Wrap" Text="{Binding Model.desc.breve}" FontSize="20" Foreground="Black"/>
                    <TextBlock FontWeight="Bold" Grid.Row="2" Text="{Binding Price}" FontSize="20" Foreground="Black" />
                    <TextBlock FontWeight="Bold" Grid.Row="3" Text="{Binding QuantitaDesc}" FontSize="20" Foreground="Black" />
                </Grid>
                <toolkit:ContextMenuService.ContextMenu>
                    <toolkit:ContextMenu>
                        <!-- You can suppress tilt on indivudal menu items with TiltEffect.SuppressTilt="True" -->
                        <toolkit:MenuItem Header="elimina prodotto" Click="Elimina_Click" Tag="{Binding}"/>
                        <toolkit:MenuItem Header="aumenta quantità" Click="Aumenta_Click" Tag="{Binding}"/>
                        <toolkit:MenuItem Header="diminusci quantità" Click="Diminuisci_Click" Tag="{Binding}"/>
                    </toolkit:ContextMenu>
                </toolkit:ContextMenuService.ContextMenu>
            </Grid>
        </DataTemplate>
    </phone:PhoneApplicationPage.Resources>
    <phone:PhoneApplicationPage.Foreground>
        <SolidColorBrush Color="Black"/>
    </phone:PhoneApplicationPage.Foreground>

    <!--LayoutRoot è la griglia radice in cui viene inserito tutto il contenuto della pagina-->
    <Grid x:Name="LayoutRoot" Background="White">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition/>
            <RowDefinition Height="87"/>
        </Grid.RowDefinitions>

        <!--TitlePanel contiene il nome dell'applicazione e il titolo della pagina-->

        <!--TitlePanel contiene il nome dell'applicazione e il titolo della pagina-->
        <Grid Height="55" Margin="0" VerticalAlignment="Top" Background="{StaticResource BrushViola}"/>

        <!--TitlePanel contiene il nome dell'applicazione e il titolo della pagina-->
        <StackPanel Grid.Row="0" Margin="12,17,0,28">
            <TextBlock Text="24CARATI.COM" Style="{StaticResource PhoneTextNormalStyle}" Foreground="Black"/>
            <TextBlock Text="carrello" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}" Foreground="Black"/>
        </StackPanel>
        <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">

            <ListBox ItemsSource="{Binding Prodotti}" Margin="0,0,0,0" x:Name="lbProducts" SelectedItem="{Binding SelectedProduct, Mode=TwoWay}" ItemTemplate="{StaticResource VetrinaDataTemplate}" />


        </Grid>
        <Grid Grid.Row="2" Background="#CC272727">
            <Grid.RowDefinitions>
                <RowDefinition Height="41*"/>
                <RowDefinition Height="46*"/>
            </Grid.RowDefinitions>
            <Button Grid.RowSpan="2" HorizontalAlignment="Right" VerticalAlignment="Center" Padding="0" Style="{StaticResource ButtonStyle1}" BorderBrush="{x:Null}" Click="Acquista_Click" >
                <Grid Height="57" Width="250">
                    <Image Source="/Assets/Acquista.png" Margin="27,0,0,0"/>
                </Grid>
            </Button>
            <TextBlock Text="{Binding TotaleCarrello}" Style="{StaticResource PhoneTextNormalStyle}" Foreground="White"  FontSize="24" HorizontalAlignment="Left" VerticalAlignment="Center" FontWeight="Bold"/>
            <TextBlock Grid.Row="1" Text="{Binding Spedizioni}" Style="{StaticResource PhoneTextNormalStyle}" Foreground="White"  FontSize="24" HorizontalAlignment="Left" VerticalAlignment="Center" FontWeight="Bold" />
        </Grid>

        <!--ContentPanel - inserire ulteriore contenuto qui-->
    </Grid>

</phone:PhoneApplicationPage>